package com.ctosb.classviewer.clazz.attr;

import com.ctosb.classviewer.ClassReader;
import com.ctosb.classviewer.clazz.AbstractParse;
import com.ctosb.classviewer.clazz.Parseable;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class Value extends AbstractParse {

    private short const_value_index;
    private Enum_const_value enum_const_value;
    private short class_info_index;
    Annotation annotation_value;
    private Array_element_value array_value;

    @Override
    public Value parse(ClassReader classReader) {
        const_value_index = classReader.readShort();
        enum_const_value = new Enum_const_value().parse(classReader, getClassFile());
        class_info_index = classReader.readShort();
        annotation_value = new Annotation().parse(classReader, getClassFile());
        array_value = new Array_element_value().parse(classReader, getClassFile());
        return this;
    }
}